package com.feng.ssm.controller;

import com.feng.ssm.pojo.Book;
import com.feng.ssm.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BookController {
    @Autowired
    BookService bookService;

    @RequestMapping("/addBook")
    @ResponseBody
    public String addBook(){
        int i = bookService.addBook(new Book(1, "斗罗大陆I", 2, "今天是2021年11月2日，现在是下午15:48"));
        if (i>0){
            return "添加成功";
        }else {
            return "添加失败";
        }
    }
}
